# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Maintainer: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
pkgname=cmus
pkgver=2.10.0
pkgrel=7
pkgdesc="feature-rich ncurses-based music player"
url="https://cmus.github.io/"
arch="all"
license="GPL-2.0-or-later"
options="!check" # No test suite
makedepends="
	alsa-lib-dev
	elogind-dev
	faad2-dev
	ffmpeg-dev
	flac-dev
	libmad-dev
	libogg-dev
	libvorbis-dev
	linux-headers
	ncurses-dev
	opusfile-dev
	pulseaudio-dev
	wavpack-dev
	"
subpackages="
	$pkgname-doc
	$pkgname-zsh-completion
	$pkgname-bash-completion
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/cmus/cmus/archive/v$pkgver.tar.gz
	ffmpeg6.patch
	1172.patch
	cmus.desktop
	"

build() {
	export CFLAGS="$CFLAGS -flto=auto"
	./configure prefix=/usr
	make
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm644 AUTHORS README.md -t "$pkgdir"/usr/share/doc/$pkgname/

	install -Dm644 contrib/$pkgname.bash-completion \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 contrib/_$pkgname \
		"$pkgdir"/usr/share/zsh/site-functions/_$pkgname
	install -Dm644 "$srcdir"/cmus.desktop \
		"$pkgdir"/usr/share/applications/$pkgname.desktop
}

sha512sums="
c055dc974a88f32c7f19fb2e4260ede37fbddc3f23707a98e7f669032c1b4fd9a1032eb5c808cf5ee635617d3abf176e78d1e8596cbe669bbad95cd5c50dde7c  cmus-2.10.0.tar.gz
a8dc2e8e51020289ea4be227b9265297024da6ef3c79b666b8ea381fe413053354229d4ecfe45daa7b3e676c9c5f87525663266f840f21a462fbb91daf8ec68f  ffmpeg6.patch
f4d1e27bfbedd0f34b8852c7ca36d52d86d3b09cbe8b06ea709323d0d7a94e02135ac4c563f8bf311ffcccd23333350a19c6fa81c617e355c3d067072e9e2356  1172.patch
1adaaab23d9e74ac086ad74ecb8cac335c966b8321abf164d424148920f072020ea23406b0577f109f8bcf41dd27ce2b66f00a050a7341745df98559bb384725  cmus.desktop
"
